// 配置baseurl
// 接口地址
/* 基础数据接口地址 */

/* 上线版本 */
// export const API = 'https://www.aganyun.com'
export const API = 'https://www.aganyun.com/dp_sy_mall'
export const MAPAPI = 'https://www.aganyun.com/digplant'

export default {
  install (Vue) {
    /* 全局本地获取 */
    // Vue.prototype.getLocalStorage = (keyName) => {
    //   return (localStorage.getItem(keyName))
    // }
    /* 全局本地存储 */
    Vue.prototype.setLocalStorage = (keyName, keyValue) => {
      localStorage.setItem(keyName, keyValue)
    }
    //获取url中的手机号
    Vue.prototype.getLocalStorage = (paramName) =>  {
      paramName = paramName == 'accesstoken' ? 'token' : paramName
      let _data = ""
      let query = window.location.search
      let _arr = query.split('&')
      for(let key in _arr){
        if(_arr[key].indexOf(paramName) !== -1 && _arr[key].indexOf('=') !== -1){
          let _star = _arr[key].indexOf('=');
          _data = _arr[key].substr(_star+1,_arr[key].length)
        }
      }
      return _data
    }
  }
}
